package com.yihaodian.search.server;

import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.TermQuery;

import com.google.gson.Gson;

public class BooleanQuery2Json {
	
	public static void main(String[] args){
		BooleanQuery query=new BooleanQuery();
		query.add(new TermQuery(new Term("mcsiteId", "1")),Occur.MUST);
		query.add(new TermQuery(new Term("title","牛奶")), Occur.MUST);
		query.add(new TermQuery(new Term("brandId","222")), Occur.MUST_NOT);
		query.add(new TermQuery(new Term("categoryId","333")), Occur.SHOULD);
		Gson gson=new Gson();
		System.out.println(gson.toJson(query));
	}

}
